/*! Typograf | © 2017 Denis Seleznev | https://github.com/typograf/typograf/ */
!function(e,t){"function"==typeof define&&define.amd?define("typograf",[],t):"object"==typeof exports?module.exports=t():e.Typograf=t()}(this,function(){"use strict";function e(a){this._prefs="object"==typeof a?a:{},this._prefs.locale=e._prepareLocale(this._prefs.locale),this._prefs.live=this._prefs.live||!1,this._safeTags=new t,this._settings={},this._enabledRules={},this._innerRulesByQueues={},this._innerRules=[].concat(this._innerRules),this._innerRules.forEach(function(e){var t=e.queue||"default";this._innerRulesByQueues[t]=this._innerRulesByQueues[t]||[],this._innerRulesByQueues[t].push(e)},this),this._rulesByQueues={},this._rules=[].concat(this._rules),this._rules.forEach(function(e){var t=e.queue||"default";this._prepareRule(e),this._rulesByQueues[t]=this._rulesByQueues[t]||[],this._rulesByQueues[t].push(e)},this),this._prefs.disableRule&&this.disableRule(this._prefs.disableRule),this._prefs.enableRule&&this.enableRule(this._prefs.enableRule)}function t(){var t=[["\x3c!--","--\x3e"],["<!ENTITY",">"],["<!DOCTYPE",">"],["<\\?xml","\\?>"],["<!\\[CDATA\\[","\\]\\]>"]];["code","kbd","object","pre","samp","script","style","var"].forEach(function(e){t.push(["<"+e+"(\\s[^>]*?)?>","</"+e+">"])},this),this._tags={own:[],html:t.map(this._prepareRegExp),url:[e._reUrl]},this._groups=["own","html","url"],this._reservedGroups=[].concat(this._groups).reverse()}return e._mix=function(e,t){Object.keys(t).forEach(function(a){e[a]=t[a]})},e._mix(e,{addRule:function(e){var t=e.name.split("/");return e._enabled=!0!==e.disabled,e._locale=t[0],e._group=t[1],e._name=t[2],this.addLocale(e._locale),this._setIndex(e),this.prototype._rules.push(e),this._sortRules(this.prototype._rules),this},addInnerRule:function(e){return this.prototype._innerRules.push(e),e._locale=e.name.split("/")[0],this},deepCopy:function(e){return"object"==typeof e?JSON.parse(JSON.stringify(e)):e},_privateLabel:"\udbff",_repeat:function(e,t){for(var a="";1==(1&t)&&(a+=e),0!==(t>>>=1);)e+=e;return a},_replace:function(e,t){for(var a=0;a<t.length;a++)e=e.replace(t[a][0],t[a][1]);return e},_replaceNbsp:function(e){return e.replace(/\u00A0/g," ")},_setIndex:function(e){var t=e.index,a=typeof t,n=this.groupIndexes[e._group];"undefined"===a?t=n:"string"===a&&(t=n+parseInt(e.index,10)),e._index=t},_reUrl:new RegExp("(https?|file|ftp)://([a-zA-Z0-9/+-=%&:_.~?]+[a-zA-Z0-9#+]*)","g"),_sortRules:function(e){e.sort(function(e,t){return e._index>t._index?1:-1})}}),e.prototype={constructor:e,execute:function(t,a){var n=this;if(!(t=""+t))return"";a=a||{};var r={text:t,prefs:e.deepCopy(this._prefs),getData:function(t){return"char"===t?this.prefs.locale.map(function(a){return e.getData(a+"/"+t)}).join(""):e.getData(this.prefs.locale[0]+"/"+t)}};r.prefs.htmlEntity=a.htmlEntity||this._prefs.htmlEntity||{},r.prefs.locale=e._prepareLocale(a.locale,this._prefs.locale),r.prefs.lineEnding=a.lineEnding||this._prefs.lineEnding,r.prefs.ruleFilter=a.ruleFilter||this._prefs.ruleFilter;var u=r.prefs.locale;if(!u.length||!u[0])throw Error('Not defined the property "locale".');if(!e.hasLocale(u[0]))throw Error('"'+u[0]+'" is not supported locale.');return r.text=this._removeCR(r.text),r.isHTML=-1!==r.text.search(/(<\/?[a-z]|<!|&[lg]t;)/i),this._executeRules(r,"start"),this._safeTags.hide(r,function(e,t){n._executeRules(e,"hide-safe-tags-"+t)}),this._executeRules(r,"hide-safe-tags"),e.HtmlEntities.toUtf(r),this._prefs.live&&(r.text=e._replaceNbsp(r.text)),this._executeRules(r,"utf"),this._executeRules(r),e.HtmlEntities.restore(r),this._executeRules(r,"html-entities"),this._safeTags.show(r,function(e,t){n._executeRules(e,"show-safe-tags-"+t)}),this._executeRules(r,"end"),this._fixLineEnding(r.text,r.prefs.lineEnding)},getSetting:function(e,t){return this._settings[e]&&this._settings[e][t]},setSetting:function(e,t,a){return this._settings[e]=this._settings[e]||{},this._settings[e][t]=a,this},isEnabledRule:function(e){return this._enabledRules[e]},isDisabledRule:function(e){return!this._enabledRules[e]},enableRule:function(e){return this._enable(e,!0)},disableRule:function(e){return this._enable(e,!1)},addSafeTag:function(e,t,a){var n=e instanceof RegExp?e:[e,t,a];return this._safeTags.add(n),this},_executeRules:function(e,t){t=t||"default";var a=this._rulesByQueues[t],n=this._innerRulesByQueues[t];n&&n.forEach(function(t){this._ruleIterator(e,t)},this),a&&a.forEach(function(t){this._ruleIterator(e,t)},this)},_ruleIterator:function(e,t){var a=t._locale,n=this._prefs.live;if(!(!0===n&&!1===t.live||!1===n&&!0===t.live)&&("common"===a||a===e.prefs.locale[0])&&this.isEnabledRule(t.name)){if(e.prefs.ruleFilter&&!e.prefs.ruleFilter(t))return;this._onBeforeRule&&this._onBeforeRule(t.name,e.text,e),e.text=t.handler.call(this,e.text,this._settings[t.name],e),this._onAfterRule&&this._onAfterRule(t.name,e.text,e)}},_removeCR:function(e){return e.replace(/\r\n?/g,"\n")},_fixLineEnding:function(e,t){return"CRLF"===t?e.replace(/\n/g,"\r\n"):"CR"===t?e.replace(/\n/g,"\r"):e},_prepareRule:function(t){var a=t.name,n=typeof t.settings,r={};"object"===n?r=e.deepCopy(t.settings):"function"===n&&(r=t.settings(t)),this._settings[a]=r,this._enabledRules[a]=t._enabled},_enable:function(e,t){return Array.isArray(e)?e.forEach(function(e){this._enableByMask(e,t)},this):this._enableByMask(e,t),this},_enableByMask:function(e,t){var a;e&&(-1!==e.search(/\*/)?(a=new RegExp(e.replace(/\//g,"\\/").replace(/\*/g,".*")),this._rules.forEach(function(e){var n=e.name;a.test(n)&&(this._enabledRules[n]=t)},this)):this._enabledRules[e]=t)},_rules:[],_innerRules:[],_getRule:function(e){var t=null;return this._rules.some(function(a){return a.name===e&&(t=a,!0)}),t}},e.version="6.3.1",e._mix(e,{getData:function(e){return this._data[e]},setData:function(e,t){"string"==typeof e?(this.addLocale(e),this._data[e]=t):"object"==typeof e&&Object.keys(e).forEach(function(t){this.addLocale(t),this._data[t]=e[t]},this)},_data:{}}),e._mix(e,{addLocale:function(e){var t=(e||"").split("/")[0];t&&"common"!==t&&!this.hasLocale(t)&&(this._locales.push(t),this._locales.sort())},getLocales:function(){return this._locales},hasLocale:function(e){return"common"===e||-1!==this._locales.indexOf(e)},_prepareLocale:function(e,t){var a=e||t,n=a;return Array.isArray(a)||(n=[a]),n},_locales:[]}),t.prototype={constructor:t,add:function(e){this._tags.own.push(this._prepareRegExp(e))},show:function(t,a){var n=e._privateLabel,r=new RegExp(n+"tf\\d+"+n,"g"),u=new RegExp(n+"tf\\d"),s=function(e){return t.safeTags.hidden[t.safeTags.group][e]||e};this._reservedGroups.forEach(function(e){t.safeTags.group=e;for(var n=0,i=this._tags[e].length;n<i&&(t.text=t.text.replace(r,s),-1!==t.text.search(u));n++);a(t,e)},this),t.safeTags=null},hide:function(e,t){e.safeTags={hidden:{},i:0},this._groups.forEach(function(t){e.safeTags.hidden[t]={}},this),this._groups.forEach(function(a){this._hide(e,a),t(e,a)},this)},_hide:function(t,a){var n=function(a){var n=e._privateLabel+"tf"+t.safeTags.i+e._privateLabel;return t.safeTags.hidden[t.safeTags.group][n]=a,t.safeTags.i++,n};t.safeTags.group=a,this._tags[a].forEach(function(e){t.text=t.text.replace(this._prepareRegExp(e),n)},this),"html"===a&&t.isHTML&&(t.text=t.text.replace(/<\/?[a-z][^]*?>/gi,n).replace(/&lt;\/?[a-z][^]*?&gt;/gi,n).replace(/&[gl]t;/gi,n))},_prepareRegExp:function(e){var t;if(e instanceof RegExp)t=e;else{var a=e[0],n=e[1],r=void 0===e[2]?"[^]*?":e[2];t=new RegExp(a+r+n,"gi")}return t}},e.inlineElements=["a","abbr","acronym","b","bdo","big","br","button","cite","code","dfn","em","i","img","input","kbd","label","map","object","q","samp","script","select","small","span","strong","sub","sup","textarea","time","tt","var"],e.blockElements=["address","article","aside","blockquote","canvas","dd","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","noscript","ol","output","p","pre","section","table","tfoot","ul","video"],e.HtmlEntities={init:function(){var e=[["iexcl",161],["cent",162],["pound",163],["curren",164],["yen",165],["brvbar",166],["sect",167],["uml",168],["copy",169],["ordf",170],["laquo",171],["not",172],["reg",174],["macr",175],["deg",176],["plusmn",177],["sup2",178],["sup3",179],["acute",180],["micro",181],["para",182],["middot",183],["cedil",184],["sup1",185],["ordm",186],["raquo",187],["frac14",188],["frac12",189],["frac34",190],["iquest",191],["Agrave",192],["Aacute",193],["Acirc",194],["Atilde",195],["Auml",196],["Aring",197],["AElig",198],["Ccedil",199],["Egrave",200],["Eacute",201],["Ecirc",202],["Euml",203],["Igrave",204],["Iacute",205],["Icirc",206],["Iuml",207],["ETH",208],["Ntilde",209],["Ograve",210],["Oacute",211],["Ocirc",212],["Otilde",213],["Ouml",214],["times",215],["Oslash",216],["Ugrave",217],["Uacute",218],["Ucirc",219],["Uuml",220],["Yacute",221],["THORN",222],["szlig",223],["agrave",224],["aacute",225],["acirc",226],["atilde",227],["auml",228],["aring",229],["aelig",230],["ccedil",231],["egrave",232],["eacute",233],["ecirc",234],["euml",235],["igrave",236],["iacute",237],["icirc",238],["iuml",239],["eth",240],["ntilde",241],["ograve",242],["oacute",243],["ocirc",244],["otilde",245],["ouml",246],["divide",247],["oslash",248],["ugrave",249],["uacute",250],["ucirc",251],["uuml",252],["yacute",253],["thorn",254],["yuml",255],["fnof",402],["Alpha",913],["Beta",914],["Gamma",915],["Delta",916],["Epsilon",917],["Zeta",918],["Eta",919],["Theta",920],["Iota",921],["Kappa",922],["Lambda",923],["Mu",924],["Nu",925],["Xi",926],["Omicron",927],["Pi",928],["Rho",929],["Sigma",931],["Tau",932],["Upsilon",933],["Phi",934],["Chi",935],["Psi",936],["Omega",937],["alpha",945],["beta",946],["gamma",947],["delta",948],["epsilon",949],["zeta",950],["eta",951],["theta",952],["iota",953],["kappa",954],["lambda",955],["mu",956],["nu",957],["xi",958],["omicron",959],["pi",960],["rho",961],["sigmaf",962],["sigma",963],["tau",964],["upsilon",965],["phi",966],["chi",967],["psi",968],["omega",969],["thetasym",977],["upsih",978],["piv",982],["bull",8226],["hellip",8230],["prime",8242],["Prime",8243],["oline",8254],["frasl",8260],["weierp",8472],["image",8465],["real",8476],["trade",8482],["alefsym",8501],["larr",8592],["uarr",8593],["rarr",8594],["darr",8595],["harr",8596],["crarr",8629],["lArr",8656],["uArr",8657],["rArr",8658],["dArr",8659],["hArr",8660],["forall",8704],["part",8706],["exist",8707],["empty",8709],["nabla",8711],["isin",8712],["notin",8713],["ni",8715],["prod",8719],["sum",8721],["minus",8722],["lowast",8727],["radic",8730],["prop",8733],["infin",8734],["ang",8736],["and",8743],["or",8744],["cap",8745],["cup",8746],["int",8747],["there4",8756],["sim",8764],["cong",8773],["asymp",8776],["ne",8800],["equiv",8801],["le",8804],["ge",8805],["sub",8834],["sup",8835],["nsub",8836],["sube",8838],["supe",8839],["oplus",8853],["otimes",8855],["perp",8869],["sdot",8901],["lceil",8968],["rceil",8969],["lfloor",8970],["rfloor",8971],["lang",9001],["rang",9002],["spades",9824],["clubs",9827],["hearts",9829],["diams",9830],["loz",9674],["OElig",338],["oelig",339],["Scaron",352],["scaron",353],["Yuml",376],["circ",710],["tilde",732],["ndash",8211],["mdash",8212],["lsquo",8216],["rsquo",8217],["sbquo",8218],["ldquo",8220],["rdquo",8221],["bdquo",8222],["dagger",8224],["Dagger",8225],["permil",8240],["lsaquo",8249],["rsaquo",8250],["euro",8364],["NestedGreaterGreater",8811],["NestedLessLess",8810]],t=[["nbsp",160],["thinsp",8201],["ensp",8194],["emsp",8195],["shy",173],["zwnj",8204],["zwj",8205],["lrm",8206],["rlm",8207]];this._entities=this._prepareEntities([].concat(e,t)),this._entitiesByName={},this._entitiesByNameEntity={},this._entitiesByDigitEntity={},this._entitiesByUtf={},this._entities.forEach(function(e){this._entitiesByName[e.name]=e,this._entitiesByNameEntity[e.nameEntity]=e,this._entitiesByDigitEntity[e.digitEntity]=e,this._entitiesByUtf[e.utf]=e},this),this._invisibleEntities=this._prepareEntities(t)},toUtf:function(e){-1!==e.text.search(/&#/)&&(e.text=this.decHexToUtf(e.text)),-1!==e.text.search(/&[a-z]/i)&&this._entities.forEach(function(t){e.text=e.text.replace(t.reName,t.utf)})},decHexToUtf:function(e){return e.replace(/&#(\d{1,6});/gi,function(e,t){return String.fromCharCode(parseInt(t,10))}).replace(/&#x([\da-f]{1,6});/gi,function(e,t){return String.fromCharCode(parseInt(t,16))})},restore:function(e){var t=e.prefs.htmlEntity,a=t.type,n=this._entities;"name"!==a&&"digit"!==a||((t.onlyInvisible||t.list)&&(n=[],t.onlyInvisible&&(n=n.concat(this._invisibleEntities)),t.list&&(n=n.concat(this._prepareListParam(t.list)))),e.text=this._restoreEntitiesByIndex(e.text,a+"Entity",n))},getByUtf:function(e,t){var a="";switch(t){case"digit":a=this._entitiesByDigitEntity[e];break;case"name":a=this._entitiesByNameEntity[e];break;default:a=e}return a},_prepareEntities:function(e){var t=[];return e.forEach(function(e){var a=e[0],n=e[1],r=String.fromCharCode(n),u={name:a,nameEntity:"&"+a+";",digitEntity:"&#"+n+";",utf:r,reName:new RegExp("&"+a+";","g"),reUtf:new RegExp(r,"g")};t.push(u)},this),t},_prepareListParam:function(e){var t=[];return e.forEach(function(e){var a=this._entitiesByName[e];a&&t.push(a)},this),t},_restoreEntitiesByIndex:function(e,t,a){return a.forEach(function(a){e=e.replace(a.reUtf,a[t])}),e}},e.HtmlEntities.init(),e.groupIndexes={symbols:110,space:210,dash:310,punctuation:410,nbsp:510,number:610,money:710,date:810,other:910,optalign:1010,typo:1110,html:1210},e.setData("be/char","\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u044b\u044c\u044d\u044e\u044f\u0451\u0456\u045e\u0491"),e.setData("be/quote",{left:"\xab\u201c",right:"\xbb\u201d"}),e.setData("bg/char","\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044a\u044c\u044e\u044f"),e.setData("bg/quote",{left:"\u201e\u2019",right:"\u201c\u2019"}),e.setData("ca/char","abcdefghijlmnopqrstuvxyz\xe0\xe7\xe8\xe9\xed\xef\xf2\xf3\xfa\xfc"),e.setData("ca/quote",{left:"\xab\u201c",right:"\xbb\u201d"}),e.setData("common/char","a-z"),e.setData("common/dash","--?|\u2012|\u2013|\u2014"),e.setData("common/quote",'\xab\u2039\xbb\u203a\u201e\u201c\u201f\u201d"'),e.setData("cs/char","a-z\xe1\xe9\xed\xf3\xfa\xfd\u010d\u010f\u011b\u0148\u0159\u0161\u0165\u016f\u017e"),e.setData("cs/quote",{left:"\u201e\u201a",right:"\u201c\u2018"}),e.setData("da/char","a-z\xe5\xe6\xf8"),e.setData("da/quote",{left:"\xbb\u203a",right:"\xab\u2039"}),e.setData("de/char","a-z\xdf\xe4\xf6\xfc"),e.setData("de/quote",{left:"\u201e\u201a",right:"\u201c\u2018"}),e.setData("el/char","\u0390\u03ac\u03ad\u03ae\u03af\u03b0\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9\u03ca\u03cb\u03cc\u03cd\u03ce\u03f2\u1f71\u1f73\u1f75\u1f77\u1f79\u1f7b\u1f7d"),e.setData("el/quote",{left:"\xab\u201c",right:"\xbb\u201d"}),e.setData("en-GB/char","a-z"),e.setData("en-GB/quote",{left:"\u2018\u201c",right:"\u2019\u201d"}),e.setData("en-US/char","a-z"),e.setData("en-US/quote",{left:"\u201c\u2018",right:"\u201d\u2019"}),e.setData("eo/char","abcdefghijklmnoprstuvz\u0109\u011d\u0125\u0135\u015d\u016d"),e.setData("eo/quote",{left:"\u201c\u2018",right:"\u201d\u2019"}),e.setData("es/char","a-z\xe1\xe9\xed\xf1\xf3\xfa\xfc"),e.setData("es/quote",{left:"\xab\u201c",right:"\xbb\u201d"}),e.setData("et/char","abdefghijklmnoprstuvz\xe4\xf5\xf6\xfc\u0161\u017e"),e.setData("et/quote",{left:"\u201e\xab",right:"\u201c\xbb"}),e.setData("fi/char","abcdefghijklmnopqrstuvy\xf6\xe4\xe5"),e.setData("fi/quote",{left:"\u201d\u2019",right:"\u201d\u2019"}),e.setData("fr/char","a-z\xe0\xe2\xe7\xe8\xe9\xea\xeb\xee\xef\xf4\xfb\xfc\u0153\xe6"),e.setData("fr/quote",{left:"\xab\u2039",right:"\xbb\u203a",spacing:!0}),e.setData("ga/char","abcdefghilmnoprstuvwxyz\xe1\xe9\xed\xf3\xfa"),e.setData("ga/quote",{left:"\u201c\u2018",right:"\u201d\u2019"}),e.setData("hu/char","a-z\xe1\xe4\xe9\xed\xf3\xf6\xfa\xfc\u0151\u0171"),e.setData("hu/quote",{left:"\u201e\xbb",right:"\u201d\xab"}),e.setData("it/char","a-z\xe0\xe9\xe8\xec\xf2\xf9"),e.setData("it/quote",{left:"\xab\u201c",right:"\xbb\u201d"}),e.setData("lv/char","abcdefghijklmnopqrstuvxz\xe6\u0153"),e.setData("lv/quote",{left:"\xab\u201e",right:"\xbb\u201c"}),e.setData("nl/char","a-z\xe4\xe7\xe8\xe9\xea\xeb\xee\xef\xf1\xf6\xfb\xfc"),e.setData("nl/quote",{left:"\u2018\u201c",right:"\u2019\u201d"}),e.setData("no/char","a-z\xe5\xe6\xe8\xe9\xea\xf2\xf3\xf4\xf8"),e.setData("no/quote",{left:"\xab\u2019",right:"\xbb\u2019"}),e.setData("pl/char","abcdefghijklmnoprstuvwxyz\xf3\u0105\u0107\u0119\u0142\u0144\u015b\u017a\u017c"),e.setData("pl/quote",{left:"\u201e\xab",right:"\u201d\xbb"}),e.setData("ro/char","abcdefghijklmnoprstuvxz\xee\u0103\u0219\u021b"),e.setData("ro/quote",{left:"\u201e\xab",right:"\u201d\xbb"}),e.setData("ru/char","\u0430-\u044f\u0451"),e.setData({"ru/dashBefore":"(^| |\\n)","ru/dashAfter":"(?=[\xa0 ,.?:!]|$)","ru/dashAfterDe":"(?=[,.?:!]|[\xa0 ][^\u0410-\u042f\u0401]|$)"}),e.setData({"ru/l":"\u0430-\u044f\u0451a-z","ru/L":"\u0410-\u042f\u0401A-Z"}),e.setData({"ru/month":"\u044f\u043d\u0432\u0430\u0440\u044c|\u0444\u0435\u0432\u0440\u0430\u043b\u044c|\u043c\u0430\u0440\u0442|\u0430\u043f\u0440\u0435\u043b\u044c|\u043c\u0430\u0439|\u0438\u044e\u043d\u044c|\u0438\u044e\u043b\u044c|\u0430\u0432\u0433\u0443\u0441\u0442|\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044c|\u043e\u043a\u0442\u044f\u0431\u0440\u044c|\u043d\u043e\u044f\u0431\u0440\u044c|\u0434\u0435\u043a\u0430\u0431\u0440\u044c","ru/monthGenCase":"\u044f\u043d\u0432\u0430\u0440\u044f|\u0444\u0435\u0432\u0440\u0430\u043b\u044f|\u043c\u0430\u0440\u0442\u0430|\u0430\u043f\u0440\u0435\u043b\u044f|\u043c\u0430\u044f|\u0438\u044e\u043d\u044f|\u0438\u044e\u043b\u044f|\u0430\u0432\u0433\u0443\u0441\u0442\u0430|\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044f|\u043e\u043a\u0442\u044f\u0431\u0440\u044f|\u043d\u043e\u044f\u0431\u0440\u044f|\u0434\u0435\u043a\u0430\u0431\u0440\u044f","ru/monthPreCase":"\u044f\u043d\u0432\u0430\u0440\u0435|\u0444\u0435\u0432\u0440\u0430\u043b\u0435|\u043c\u0430\u0440\u0442\u0435|\u0430\u043f\u0440\u0435\u043b\u0435|\u043c\u0430\u0435|\u0438\u044e\u043d\u0435|\u0438\u044e\u043b\u0435|\u0430\u0432\u0433\u0443\u0441\u0442\u0435|\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u0435|\u043e\u043a\u0442\u044f\u0431\u0440\u0435|\u043d\u043e\u044f\u0431\u0440\u0435|\u0434\u0435\u043a\u0430\u0431\u0440\u0435","ru/shortMonth":"\u044f\u043d\u0432|\u0444\u0435\u0432|\u043c\u0430\u0440|\u0430\u043f\u0440|\u043c\u0430[\u0435\u0439\u044f]|\u0438\u044e\u043d|\u0438\u044e\u043b|\u0430\u0432\u0433|\u0441\u0435\u043d|\u043e\u043a\u0442|\u043d\u043e\u044f|\u0434\u0435\u043a"}),e.setData("ru/quote",{left:"\xab\u201e\u201a",right:"\xbb\u201c\u2018",removeDuplicateQuotes:!0}),e.setData("ru/weekday","\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a|\u0432\u0442\u043e\u0440\u043d\u0438\u043a|\u0441\u0440\u0435\u0434\u0430|\u0447\u0435\u0442\u0432\u0435\u0440\u0433|\u043f\u044f\u0442\u043d\u0438\u0446\u0430|\u0441\u0443\u0431\u0431\u043e\u0442\u0430|\u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435"),e.setData("sk/char","abcdefghijklmnoprstuvwxyz\xe1\xe4\xe9\xed\xf3\xf4\xfa\xfd\u010d\u010f\u013e\u0148\u0155\u0161\u0165\u017e"),e.setData("sk/quote",{left:"\u201e\u201a",right:"\u201c\u2018"}),e.setData("sl/char","a-z\u010d\u0161\u017e"),e.setData("sl/quote",{left:"\u201e\u201a",right:"\u201c\u2018"}),e.setData("sr/char","abcdefghijklmnoprstuvz\u0107\u010d\u0111\u0161\u017e"),e.setData("sr/quote",{left:"\u201e\u2019",right:"\u201d\u2019"}),e.setData("sv/char","a-z\xe4\xe5\xe9\xf6"),e.setData("sv/quote",{left:"\u201d\u2019",right:"\u201d\u2019"}),e.setData("tr/char","abcdefghijklmnoprstuvyz\xe2\xe7\xee\xf6\xfb\xfc\u011f\u0131\u015f"),e.setData("tr/quote",{left:"\u201c\u2018",right:"\u201d\u2019"}),e.setData("uk/char","\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044c\u044e\u044f\u0454\u0456\u0457\u0491"),e.setData("uk/quote",{left:"\xab\u201e",right:"\xbb\u201c"}),e.addRule({name:"common/html/e-mail",queue:"end",handler:function(e,t,a){return a.isHTML?e:e.replace(/(^|[\s;(])([\w\-.]{2,})@([\w\-.]{2,})\.([a-z]{2,6})([)\s.,!?]|$)/gi,'$1<a href="mailto:$2@$3.$4">$2@$3.$4</a>$5')},disabled:!0,htmlAttrs:!1}),e.addRule({name:"common/html/escape",index:"+100",queue:"end",handler:function(e){var t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};return e.replace(/[&<>"'/]/g,function(e){return t[e]})},disabled:!0}),e.addRule({name:"common/html/nbr",index:"+10",queue:"end",handler:function(e){return e.replace(/([^\n>])\n(?=[^\n])/g,"$1<br/>\n")},disabled:!0,htmlAttrs:!1}),e.addRule({name:"common/html/p",index:"+5",queue:"end",handler:function(t){var a=new RegExp("<("+e.blockElements.join("|")+")[>\\s]"),n=t.split("\n\n");return n.forEach(function(e,t,n){e.trim()&&(a.test(e)||(n[t]=e.replace(/^(\s*)/,"$1<p>").replace(/(\s*)$/,"</p>$1")))}),n.join("\n\n")},disabled:!0,htmlAttrs:!1}),e.addRule({name:"common/html/processingAttrs",queue:"hide-safe-tags-own",handler:function(t,a,n){var r=this,u=new RegExp("(^|\\s)("+a.attrs.join("|")+")=(\"[^\"]*?\"|'[^']*?')","gi"),s=e.deepCopy(n.prefs);return s.ruleFilter=function(e){return!1!==e.htmlAttrs},t.replace(/(<[-\w]+\s)([^>]+?)(?=>)/g,function(e,t,a){return t+a.replace(u,function(e,t,a,n){var u=n[0],i=n[n.length-1],l=n.slice(1,-1);return t+a+"="+u+r.execute(l,s)+i})})},settings:{attrs:["title","placeholder"]},disabled:!0,htmlAttrs:!1}),e.addRule({name:"common/html/quot",queue:"hide-safe-tags",handler:function(e){return e.replace(/&quot;/g,'"')}}),e.addRule({name:"common/html/stripTags",index:"+99",queue:"end",handler:function(e){return e.replace(/<[^>]+>/g,"")},disabled:!0}),e.addRule({name:"common/html/url",queue:"end",handler:function(t,a,n){return n.isHTML?t:t.replace(e._reUrl,function(e,t,a){a=a.replace(/([^/]+\/?)(\?|#)$/,"$1").replace(/^([^/]+)\/$/,"$1"),"http"===t?a=a.replace(/^([^/]+)(:80)([^\d]|\/|$)/,"$1$3"):"https"===t&&(a=a.replace(/^([^/]+)(:443)([^\d]|\/|$)/,"$1$3"));var n=a,r=t+"://"+a,u='<a href="'+r+'">';return"http"===t||"https"===t?(n=n.replace(/^www\./,""),u+("http"===t?n:t+"://"+n)+"</a>"):u+r+"</a>"})},disabled:!0,htmlAttrs:!1}),e.addRule({name:"common/nbsp/afterNumber",handler:function(e,t,a){var n="(^|\\D)(\\d{1,5}) (["+a.getData("char")+"]{2,})";return e.replace(new RegExp(n,"gi"),"$1$2\xa0$3")},disabled:!0}),e.addRule({name:"common/nbsp/afterParagraph",handler:function(e){return e.replace(/\u00A7[ \u00A0\u2009]?(\d|I|V|X)/g,"\xa7\u202f$1")}}),e.addRule({name:"common/nbsp/afterShortWord",handler:function(t,a,n){var r=a.lengthShortWord,u="(^|["+(" \xa0("+e._privateLabel+e.getData("common/quote"))+"])(["+n.getData("char")+"]{1,"+r+"}) ",s=new RegExp(u,"gim");return t.replace(s,"$1$2\xa0").replace(s,"$1$2\xa0")},settings:{lengthShortWord:2}}),e.addRule({name:"common/nbsp/beforeShortLastNumber",handler:function(e,t,a){var n=a.getData("char"),r=n.toUpperCase(),u=new RegExp("(["+n+r+"]) (?=\\d{1,"+t.lengthLastNumber+"}[-+\u2212%'\""+a.getData("quote").right+"]?([.!?\u2026]( ["+r+"]|$)|$))","gm");return e.replace(u,"$1\xa0")},live:!1,settings:{lengthLastNumber:2}}),e.addRule({name:"common/nbsp/beforeShortLastWord",handler:function(e,t,a){var n=a.getData("char"),r=n.toUpperCase(),u=new RegExp("(["+n+"\\d]) (["+n+r+"]{1,"+t.lengthLastWord+"}[.!?\u2026])( ["+r+"]|$)","g");return e.replace(u,"$1\xa0$2$3")},settings:{lengthLastWord:3}}),e.addRule({name:"common/nbsp/dpi",handler:function(e){return e.replace(/(\d) ?(lpi|dpi)(?!\w)/,"$1\xa0$2")}}),function(){function t(e,t,a,n){return t+a.replace(/([^\u00A0])\u00A0([^\u00A0])/g,"$1 $2")+n}e.addRule({name:"common/nbsp/nowrap",queue:"end",handler:function(e){return e.replace(/(<nowrap>)(.*?)(<\/nowrap>)/g,t).replace(/(<nobr>)(.*?)(<\/nobr>)/g,t)}})}(),e.addRule({name:"common/nbsp/replaceNbsp",queue:"utf",live:!1,handler:e._replaceNbsp,disabled:!0}),e.addRule({name:"common/other/delBOM",queue:"start",index:-1,handler:function(e){return 65279===e.charCodeAt(0)?e.slice(1):e}}),e.addRule({name:"common/other/repeatWord",handler:function(t,a,n){var r="[;:,.?! \n"+e.getData("common/quote")+"]",u=new RegExp("("+r+"|^)(["+n.getData("char")+"]{"+a.min+",}) \\2("+r+"|$)","gi");return t.replace(u,"$1$2$3")},settings:{min:2},disabled:!0}),e.addRule({name:"common/number/fraction",handler:function(e){return e.replace(/(^|\D)1\/2(\D|$)/g,"$1\xbd$2").replace(/(^|\D)1\/4(\D|$)/g,"$1\xbc$2").replace(/(^|\D)3\/4(\D|$)/g,"$1\xbe$2")}}),e.addRule({name:"common/number/mathSigns",handler:function(t){return e._replace(t,[[/!=/g,"\u2260"],[/<=/g,"\u2264"],[/(^|[^=])>=/g,"$1\u2265"],[/<=>/g,"\u21d4"],[/<</g,"\u226a"],[/>>/g,"\u226b"],[/~=/g,"\u2245"],[/(^|[^+])\+-/g,"$1\xb1"]])}}),e.addRule({name:"common/number/times",handler:function(e){return e.replace(/(\d)[ \u00A0]?[x\u0445][ \u00A0]?(\d)/g,"$1\xd7$2")}}),e.addRule({name:"common/punctuation/apostrophe",handler:function(e,t,a){var n="(["+a.getData("char")+"])",r=new RegExp(n+"'"+n,"gi");return e.replace(r,"$1\u2019$2")}}),e.addRule({name:"common/punctuation/delDoublePunctuation",handler:function(e){return e.replace(/(^|[^,]),,(?!,)/g,"$1,").replace(/(^|[^:])::(?!:)/g,"$1:").replace(/(^|[^!?.])\.\.(?!\.)/g,"$1.").replace(/(^|[^;]);;(?!;)/g,"$1;").replace(/(^|[^?])\?\?(?!\?)/g,"$1?")}}),e.addRule({name:"common/punctuation/quote",handler:function(e,t,a){var n=t[a.prefs.locale[0]];if(!n)return e;var r=n.left[0],u=n.right[0],s=n.left[1]||r;return e=this._setQuotes(e,n),n.removeDuplicateQuotes&&r===s&&(e=e.replace(new RegExp(r+r,"g"),r).replace(new RegExp(u+u,"g"),u)),e},settings:function(){var t={};return e.getLocales().forEach(function(a){t[a]=e.deepCopy(e.getData(a+"/quote"))}),t}}),e._mix(e.prototype,{_setQuotes:function(t,a){var n=e._privateLabel,r=a.left[0],u=a.right[0],s=a.left[1]||r,i="["+e.getData("common/quote")+"]",l=new RegExp('(^|[ \\t\\n\xa0[(])("{1,3})(?=[^ \\t\\n\xa0])',"gim"),o=new RegExp('([^ \\t\\n\xa0])("{1,3})(?=[!?.:;#*,\u2026)\\s'+n+"]|$)","gim"),c=new RegExp(i,"g"),d=new RegExp("("+n+')"(?=[^ \\t\\n'+n+"]|$)","gm"),p=0;return a.spacing&&(t=this._removeQuoteSpacing(t,a)),t=t.replace(c,function(){return p++,'"'}),t=t.replace(l,function(t,a,n){return a+e._repeat(r,n.length)}).replace(o,function(t,a,n){return a+e._repeat(u,n.length)}).replace(d,"$1"+u),r!==s&&p%2==0&&(t=this._setInnerQuotes(t,a)),a.spacing&&(t=this._setQuoteSpacing(t,a)),t},_removeQuoteSpacing:function(e,t){for(var a=0,n=t.left.length;a<n;a++){var r=t.left[a],u=t.right[a];e=e.replace(new RegExp(r+"([ \u202f\xa0])","g"),r).replace(new RegExp("([ \u202f\xa0])"+u,"g"),u)}return e},_setQuoteSpacing:function(e,t){for(var a=0,n=t.left.length;a<n;a++){var r=t.left[a],u=t.right[a];e=e.replace(new RegExp(r+"([^\u202f])","g"),r+"\u202f$1").replace(new RegExp("([^\u202f])"+u,"g"),"$1\u202f"+u)}return e},_setInnerQuotes:function(e,t){for(var a=[],n=[],r=0;r<t.left.length;r++)a.push(t.left[r]),n.push(t.right[r]);for(var u=t.left[0],s=t.right[0],i=new Array(e.length),l=a.length-1,o=-1,c=0,d=e.length;c<d;c++){var p=e[c];p===u?(++o>l&&(o=l),i.push(a[o])):p===s?o<=-1?(o=0,i.push(a[o])):(i.push(n[o]),--o<-1&&(o=-1)):('"'===p&&(o=-1),i.push(p))}return i.join("")}}),e.addRule({name:"common/punctuation/quoteLink",queue:"show-safe-tags-html",index:"+5",handler:function(t,a,n){var r=this.getSetting("common/punctuation/quote",n.prefs.locale[0]);if(!r)return t;var u=e.HtmlEntities,s=u.getByUtf(r.left[0]),i=u.getByUtf(r.right[0]),l=u.getByUtf(r.left[1]),o=u.getByUtf(r.right[1]);l=l?"|"+l:"",o=o?"|"+o:"";var c=new RegExp("(<[aA]\\s[^>]*?>)("+s+l+")([^]*?)("+i+o+")(</[aA]>)","g");return t.replace(c,"$2$1$3$5$4")}}),e.addRule({name:"common/symbols/arrow",handler:function(t){return e._replace(t,[[/(^|[^-])->(?!>)/g,"$1\u2192"],[/(^|[^<])<-(?!-)/g,"$1\u2190"]])}}),e.addRule({name:"common/symbols/cf",handler:function(e){var t=new RegExp('(^|[^%])(\\d+)( |\xa0)?(C|F)([\\W \\.,:!\\?"\\]\\)]|$)',"g");return e.replace(t,"$1$2\u2009\xb0$4$5")}}),e.addRule({name:"common/symbols/copy",handler:function(t){return e._replace(t,[[/\(r\)/gi,"\xae"],[/(copyright )?\((c|\u0441)\)/gi,"\xa9"],[/\(tm\)/gi,"\u2122"]])}}),e.addRule({name:"common/space/afterPunctuation",handler:function(t){var a=e._privateLabel,n=new RegExp("(!|;|\\?)([^).!;?\\s[\\])"+a+e.getData("common/quote")+"])","g"),r=new RegExp('(\\D)(,|:)([^)",:.?\\s\\/\\\\'+a+"])","g");return t.replace(n,"$1 $2").replace(r,"$1$2 $3")}}),e.addRule({name:"common/space/beforeBracket",handler:function(e,t,a){var n=new RegExp("(["+a.getData("char")+".!?,;\u2026)])\\(","gi");return e.replace(n,"$1 (")}}),e.addRule({name:"common/space/bracket",handler:function(e){return e.replace(/(\() +/g,"(").replace(/ +\)/g,")")}}),e.addRule({name:"common/space/delBeforePercent",handler:function(e){return e.replace(/(\d)( |\u00A0)(%|\u2030|\u2031)/g,"$1$3")}}),e.addRule({name:"common/space/delBeforePunctuation",handler:function(e){return e.replace(/ ([!;,?.:])(?!\))/g,"$1")}}),e.addRule({name:"common/space/delLeadingBlanks",handler:function(e){return e.replace(/\n[ \t]+/g,"\n")},disabled:!0}),e.addRule({name:"common/space/delRepeatN",index:"-1",handler:function(e){return e.replace(/\n{3,}/g,"\n\n")}}),e.addRule({name:"common/space/delRepeatSpace",index:"-1",handler:function(e){return e.replace(/([^\n \t])[ \t]{2,}(?![\n \t])/g,"$1 ")}}),e.addRule({name:"common/space/delTrailingBlanks",index:"-3",handler:function(e){return e.replace(/[ \t]+\n/g,"\n")}}),e.addRule({name:"common/space/replaceTab",index:"-5",handler:function(e){return e.replace(/\t/g,"    ")}}),e.addRule({name:"common/space/squareBracket",handler:function(e){return e.replace(/(\[) +/g,"[").replace(/ +\]/g,"]")}}),e.addRule({name:"common/space/trimLeft",index:"-4",handler:String.prototype.trimLeft?function(e){return e.trimLeft()}:function(e){return e.replace(/^[\s\uFEFF\xA0]+/g,"")}}),e.addRule({name:"common/space/trimRight",index:"-3",live:!1,handler:String.prototype.trimRight?function(e){return e.trimRight()}:function(e){return e.replace(/[\s\uFEFF\xA0]+$/g,"")}}),e.addRule({name:"ru/date/fromISO",handler:function(e){var t="(-|\\.|\\/)",a=new RegExp("(^|\\D)(\\d{4})"+t+"(\\d{2})"+t+"(\\d{2})(\\D|$)","gi"),n=new RegExp("(^|\\D)(\\d{2})(-|\\/)(\\d{2})(-|\\/)(\\d{4})(\\D|$)","gi");return e.replace(a,"$1$6.$4.$2$7").replace(n,"$1$4.$2.$6$7")}}),e.addRule({name:"ru/date/weekday",handler:function(t){var a=e.getData("ru/monthGenCase"),n=e.getData("ru/weekday"),r=new RegExp("(\\d)( |\xa0)("+a+"),( |\xa0)("+n+")","gi");return t.replace(r,function(){var e=arguments;return e[1]+e[2]+e[3].toLowerCase()+","+e[4]+e[5].toLowerCase()})}}),e.addRule({name:"ru/dash/centuries",handler:function(t,a){var n="("+e.getData("common/dash")+")",r=new RegExp("(X|I|V)[ |\xa0]?"+n+"[ |\xa0]?(X|I|V)","g");return t.replace(r,"$1"+a.dash+"$3")},settings:{dash:"\u2013"}}),e.addRule({name:"ru/dash/daysMonth",handler:function(t,a){var n=new RegExp("(^|\\s)([123]?\\d)("+e.getData("common/dash")+")([123]?\\d)[ \xa0]("+e.getData("ru/monthGenCase")+")","g");return t.replace(n,"$1$2"+a.dash+"$4\xa0$5")},settings:{dash:"\u2013"}}),e.addRule({name:"ru/dash/de",handler:function(t){var a=new RegExp("([a-\u044f\u0451]+) \u0434\u0435"+e.getData("ru/dashAfterDe"),"g");return t.replace(a,"$1-\u0434\u0435")},disabled:!0}),e.addRule({name:"ru/dash/decade",handler:function(t,a){var n=new RegExp("(^|\\s)(\\d{3}|\\d)0("+e.getData("common/dash")+")(\\d{3}|\\d)0(-\u0435[ \xa0])(?=\u0433\\.?[ \xa0]?\u0433|\u0433\u043e\u0434)","g");return t.replace(n,"$1$20"+a.dash+"$40$5")},settings:{dash:"\u2013"}}),e.addRule({name:"ru/dash/directSpeech",handler:function(t){var a=e.getData("common/dash"),n=new RegExp('(["\xbb\u2018\u201c,])[ |\xa0]?('+a+")[ |\xa0]","g"),r=new RegExp("(^|"+e._privateLabel+")("+a+")( |\xa0)","gm"),u=new RegExp("([.\u2026?!])[ \xa0]("+a+")[ \xa0]","g");return t.replace(n,"$1\xa0\u2014 ").replace(r,"$1\u2014\xa0").replace(u,"$1 \u2014\xa0")}}),e.addRule({name:"ru/dash/izpod",handler:function(t){var a=new RegExp(e.getData("ru/dashBefore")+"(\u0418|\u0438)\u0437 \u043f\u043e\u0434"+e.getData("ru/dashAfter"),"g");return t.replace(a,"$1$2\u0437-\u043f\u043e\u0434")}}),e.addRule({name:"ru/dash/izza",handler:function(t){var a=new RegExp(e.getData("ru/dashBefore")+"(\u0418|\u0438)\u0437 \u0437\u0430"+e.getData("ru/dashAfter"),"g");return t.replace(a,"$1$2\u0437-\u0437\u0430")}}),e.addRule({name:"ru/dash/ka",handler:function(t){var a=new RegExp("([a-\u044f\u0451]+) \u043a\u0430(\u0441\u044c)?"+e.getData("ru/dashAfter"),"g");return t.replace(a,"$1-\u043a\u0430$2")}}),e.addRule({name:"ru/dash/koe",handler:function(t){var a=new RegExp(e.getData("ru/dashBefore")+"([\u041a\u043a]\u043e[\u0435\u0439])\\s([\u0430-\u044f\u0451]{3,})"+e.getData("ru/dashAfter"),"g");return t.replace(a,"$1$2-$3")}}),e.addRule({name:"ru/dash/main",index:"-5",handler:function(t){var a=e.getData("common/dash"),n=new RegExp("([ \xa0])("+a+")([ \xa0\\n])","g");return t.replace(n,"\xa0\u2014$3")}}),e.addRule({name:"ru/dash/month",handler:function(t,a){var n="("+e.getData("ru/month")+")",r="("+e.getData("ru/monthPreCase")+")",u=e.getData("common/dash"),s=new RegExp(n+" ?("+u+") ?"+n,"gi"),i=new RegExp(r+" ?("+u+") ?"+r,"gi"),l="$1"+a.dash+"$3";return t.replace(s,l).replace(i,l)},settings:{dash:"\u2013"}}),e.addRule({name:"ru/dash/surname",handler:function(e){var t=new RegExp("([\u0410-\u042f\u0401][\u0430-\u044f\u0451]+)\\s-([\u0430-\u044f\u0451]{1,3})(?![^\u0430-\u044f\u0451]|$)","g");return e.replace(t,"$1\xa0\u2014$2")}}),e.addRule({name:"ru/dash/taki",handler:function(t){var a=new RegExp("(\u0432\u0435\u0440\u043d\u043e|\u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e|\u043e\u043f\u044f\u0442\u044c|\u043f\u0440\u044f\u043c\u043e|\u0442\u0430\u043a|\u0432\u0441[\u0435\u0451]|\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e|\u043d\u0435\u0443\u0436\u0435\u043b\u0438)\\s(\u0442\u0430\u043a\u0438)"+e.getData("ru/dashAfter"),"g");return t.replace(a,"$1-$2")}}),e.addRule({name:"ru/dash/time",handler:function(t,a){var n=new RegExp(e.getData("ru/dashBefore")+"(\\d?\\d:[0-5]\\d)"+e.getData("common/dash")+"(\\d?\\d:[0-5]\\d)"+e.getData("ru/dashAfter"),"g");return t.replace(n,"$1$2"+a.dash+"$3")},settings:{dash:"\u2013"}}),e.addRule({name:"ru/dash/to",handler:function(t){var a=["\u043e\u0442\u043a\u0443\u0434\u0430","\u043a\u0443\u0434\u0430","\u0433\u0434\u0435","\u043a\u043e\u0433\u0434\u0430","\u0437\u0430\u0447\u0435\u043c","\u043f\u043e\u0447\u0435\u043c\u0443","\u043a\u0430\u043a","\u043a\u0430\u043a\u043e[\u0435\u0439\u043c]","\u043a\u0430\u043a\u0430\u044f","\u043a\u0430\u043a\u0438[\u0435\u043c\u0445]","\u043a\u0430\u043a\u0438\u043c\u0438","\u043a\u0430\u043a\u0443\u044e","\u0447\u0442\u043e","\u0447\u0435\u0433\u043e","\u0447\u0435[\u0439\u043c]","\u0447\u044c\u0438\u043c?","\u043a\u0442\u043e","\u043a\u043e\u0433\u043e","\u043a\u043e\u043c\u0443","\u043a\u0435\u043c"],n=new RegExp("("+a.join("|")+")( | -|- )(\u0442\u043e|\u043b\u0438\u0431\u043e|\u043d\u0438\u0431\u0443\u0434\u044c)"+e.getData("ru/dashAfter"),"gi");return t.replace(n,"$1-$3")}}),e.addRule({name:"ru/dash/weekday",handler:function(t,a){var n="("+e.getData("ru/weekday")+")",r=new RegExp(n+" ?("+e.getData("common/dash")+") ?"+n,"gi");return t.replace(r,"$1"+a.dash+"$3")},settings:{dash:"\u2013"}}),e.addRule({name:"ru/dash/years",handler:function(t,a){var n=e.getData("common/dash"),r=new RegExp("(\\D|^)(\\d{4})[ \xa0]?("+n+")[ \xa0]?(\\d{4})(?=[ \xa0]?\u0433)","g");return t.replace(r,function(e,t,n,r,u){return parseInt(n,10)<parseInt(u,10)?t+n+a.dash+u:e})},settings:{dash:"\u2013"}}),e.addRule({name:"ru/money/currency",handler:function(e){var t=new RegExp("(^|[\\D]{2})([$\u20ac\xa5\u04b0\xa3\u20a4\u20bd]) ?([\\d.,]+([ \xa0\u2009\u202f]\\d{3})*)([ \xa0\u2009\u202f]?(\u0442\u044b\u0441\\.|\u043c\u043b\u043d|\u043c\u043b\u0440\u0434|\u0442\u0440\u043b\u043d))?","gm"),a=new RegExp("(^|[\\D])([\\d.,]+) ?([$\u20ac\xa5\u04b0\xa3\u20a4\u20bd])","gm");return e.replace(t,function(e,t,a,n,r,u,s){return t+n+(s?"\xa0"+s:"")+"\xa0"+a}).replace(a,"$1$2\xa0$3")}}),e.addRule({name:"ru/money/ruble",handler:function(e){var t="(\\d+)( |\xa0)?(\u0440|\u0440\u0443\u0431)\\.",a=new RegExp("^"+t+"$","g"),n=new RegExp(t+"(?=[!?,:;])","g"),r=new RegExp(t+"(?=\\s+[A-\u042f\u0401])","g");return e.replace(a,"$1\xa0\u20bd").replace(n,"$1\xa0\u20bd").replace(r,"$1\xa0\u20bd.")},disabled:!0}),e.addRule({name:"ru/nbsp/abbr",handler:function(t){function a(e,t,a,n){return["\u0440\u0444","\u0440\u0443","\u0440\u0443\u0441","\u043e\u0440\u0433","\u0443\u043a\u0440","\u0431\u0433","\u0441\u0440\u0431"].indexOf(n)>-1?e:t+a+".\xa0"+n+"."}var n=new RegExp("(^|\\s|"+e._privateLabel+")([\u0430-\u044f\u0451]{1,3})\\. ?([\u0430-\u044f\u0451]{1,3})\\.","g");return t.replace(n,a).replace(n,a)}}),e.addRule({name:"ru/nbsp/addr",handler:function(e){return e.replace(/(\s|^)(\u0434\u043e\u043c|\u0434\.|\u043a\u0432\.|\u043f\u043e\u0434\.|\u043f-\u0434) *(\d+)/gi,"$1$2\xa0$3").replace(/(\s|^)(\u043c\u043a\u0440-\u043d|\u043c\u043a-\u043d|\u043c\u043a\u0440\.|\u043c\u043a\u0440\u043d)\s/gi,"$1$2\xa0").replace(/(\s|^)(\u044d\u0442\.) *(-?\d+)/gi,"$1$2\xa0$3").replace(/(\s|^)(\d+) +\u044d\u0442\u0430\u0436([^\u0430-\u044f\u0451]|$)/gi,"$1$2\xa0\u044d\u0442\u0430\u0436$3").replace(/(\s|^)\u043b\u0438\u0442\u0435\u0440\s([\u0410-\u042f]|$)/gi,"$1\u043b\u0438\u0442\u0435\u0440\xa0$2").replace(/(\s|^)(\u043e\u0431\u043b|\u043a\u0440|\u0441\u0442|\u043f\u043e\u0441|\u0441|\u0434|\u0443\u043b|\u043f\u0435\u0440|\u043f\u0440|\u043f\u0440-\u0442|\u043f\u0440\u043e\u0441\u043f|\u043f\u043b|\u0431\u0443\u043b|\u0431-\u0440|\u043d\u0430\u0431|\u0448|\u0442\u0443\u043f|\u043e\u0444|\u043a\u043e\u043c\u043d?|\u0443\u0447|\u0432\u043b|\u0432\u043b\u0430\u0434|\u0441\u0442\u0440|\u043a\u043e\u0440)\. *([\u0430-\u044f\u0451a-z\d]+)/gi,"$1$2.\xa0$3").replace(/(\D[ \u00A0]|^)\u0433\. ?([\u0410-\u042f\u0401])/gm,"$1\u0433.\xa0$2")}}),e.addRule({name:"ru/nbsp/afterNumberSign",handler:function(e){return e.replace(/\u2116[ \u00A0\u2009]?(\d|\u043f\/\u043f)/g,"\u2116\u202f$1")}}),e.addRule({name:"ru/nbsp/beforeParticle",index:"+5",handler:function(e){var t=new RegExp('([\u0410-\u042f\u0401\u0430-\u044f\u0451]) (\u043b\u0438|\u043b\u044c|\u0436\u0435|\u0436|\u0431\u044b|\u0431)(?=[,;:?!"\u2018\u201c\xbb])',"g"),a=new RegExp("([\u0410-\u042f\u0401\u0430-\u044f\u0451])[ \xa0](\u043b\u0438|\u043b\u044c|\u0436\u0435|\u0436|\u0431\u044b|\u0431)[ \xa0]","g");return e.replace(t,"$1\xa0$2").replace(a,"$1\xa0$2 ")}}),e.addRule({name:"ru/nbsp/centuries",handler:function(t){var a=e.getData("common/dash"),n='(?=[,;:?!"\u2018\u201c\xbb]|$)',r=new RegExp("(^|\\s)([VIX]+)[ \xa0]?\u0432\\.?"+n,"gm"),u=new RegExp("(^|\\s)([VIX]+)("+a+")([VIX]+)[ \xa0]?\u0432\\.?([ \xa0]?\u0432\\.?)?"+n,"gm");return t.replace(r,"$1$2\xa0\u0432.").replace(u,"$1$2$3$4\xa0\u0432\u0432.")}}),e.addRule({name:"ru/nbsp/dayMonth",handler:function(t){var a=new RegExp("(\\d{1,2}) ("+e.getData("ru/shortMonth")+")","gi");return t.replace(a,"$1\xa0$2")}}),e.addRule({name:"ru/nbsp/groupNumbers",handler:function(e){return e.replace(/(^ ?|\D )(\d{1,3}([ \u00A0\u202F\u2009]\d{3})+)(?! ?[\d-])/gm,function(e,t,a){return t+a.replace(/\s/g,"\u202f")})}}),e.addRule({name:"ru/nbsp/initials",handler:function(t){var a=e.getData("ru/quote"),n=new RegExp("(^|[\xa0\u202f "+a.left+e._privateLabel+'"])([\u0410-\u042f\u0401])\\.[\xa0\u202f ]?([\u0410-\u042f\u0401])\\.[\xa0\u202f ]?([\u0410-\u042f\u0401][\u0430-\u044f\u0451]+)(?=[\\s.,;:?!"'+a.right+"]|$)","gm");return t.replace(n,"$1$2.\xa0$3.\xa0$4")}}),e.addRule({name:"ru/nbsp/m",index:"+5",handler:function(t){var a=e._privateLabel,n=new RegExp("(^|[\\s,."+a+"])(\\d+)[ \xa0]?(\u043c\u043c?|\u0441\u043c|\u043a\u043c|\u0434\u043c|\u0433\u043c|mm?|km|cm|dm)([23\xb2\xb3])?([\\s.!?,;"+a+"]|$)","gm");return t.replace(n,function(e,t,a,n,r,u){return t+a+"\xa0"+n+{2:"\xb2","\xb2":"\xb2",3:"\xb3","\xb3":"\xb3","":""}[r||""]+("\xa0"===u?" ":u)})}}),e.addRule({name:"ru/nbsp/mln",handler:function(e){return e.replace(/(\d) ?(\u0442\u044b\u0441|\u043c\u043b\u043d|\u043c\u043b\u0440\u0434|\u0442\u0440\u043b\u043d)(\.|\s|$)/gi,"$1\xa0$2$3")}}),e.addRule({name:"ru/nbsp/ooo",handler:function(e){return e.replace(/(^|[^a-\u044f\u0451A-\u042f\u0401])(\u041e\u041e\u041e|\u041e\u0410\u041e|\u0417\u0410\u041e|\u041d\u0418\u0418|\u041f\u0411\u041e\u042e\u041b) /g,"$1$2\xa0")}}),e.addRule({name:"ru/nbsp/page",handler:function(t){var a=new RegExp("(^|[)\\s"+e._privateLabel+"])(\u0441\u0442\u0440|\u0433\u043b|\u0440\u0438\u0441|\u0438\u043b\u043b?|\u0441\u0442|\u043f|c)\\. *(\\d+)([\\s.,?!;:]|$)","gim");return t.replace(a,"$1$2.\xa0$3$4")}}),e.addRule({name:"ru/nbsp/ps",handler:function(t){var a=new RegExp("(^|\\s|"+e._privateLabel+")[p\u0437]\\.[ \xa0]?([p\u0437]\\.[ \xa0]?)?[s\u044b]\\.:? ","gim");return t.replace(a,function(e,t,a){return t+(a?"P.\xa0P.\xa0S. ":"P.\xa0S. ")})}}),e.addRule({name:"ru/nbsp/rubleKopek",handler:function(e){return e.replace(/(\d) ?(?=(\u0440\u0443\u0431|\u043a\u043e\u043f)\.)/g,"$1\xa0")}}),e.addRule({name:"ru/nbsp/see",handler:function(t){var a=new RegExp("(^|\\s|"+e._privateLabel+"|\\()(\u0441\u043c|\u0438\u043c)\\.[ \xa0]?([\u0430-\u044f\u04510-9a-z]+)([\\s.,?!]|$)","gi");return t.replace(a,function(e,t,a,n,r){return("\xa0"===t?" ":t)+a+".\xa0"+n+r})}}),e.addRule({name:"ru/nbsp/year",handler:function(e){return e.replace(/(^|\D)(\d{4}) ?\u0433([ ,;.\n]|$)/g,"$1$2\xa0\u0433$3")}}),e.addRule({name:"ru/nbsp/years",index:"+5",handler:function(t){var a=e.getData("common/dash"),n=new RegExp("(^|\\D)(\\d{4})("+a+')(\\d{4})[ \xa0]?\u0433\\.?([ \xa0]?\u0433\\.)?(?=[,;:?!"\u2018\u201c\xbb\\s]|$)',"gm");return t.replace(n,"$1$2$3$4\xa0\u0433\u0433.")}}),e.addRule({name:"ru/number/comma",handler:function(e){return e.replace(/(^|\s)(\d+)\.(\d+[\u00A0\u2009\u202F ]*?[%\u2030\xb0\xd7x])/gim,"$1$2,$3")}}),e.addRule({name:"ru/number/ordinals",handler:function(e,t,a){var n=new RegExp("(\\d[%\u2030]?)-(\u044b\u0439|\u043e\u0439|\u0430\u044f|\u043e\u0435|\u044b\u0435|\u044b\u043c|\u043e\u043c|\u044b\u0445|\u043e\u0433\u043e|\u043e\u043c\u0443|\u044b\u043c\u0438)(?!["+a.getData("char")+"])","g");return e.replace(n,function(e,t,a){return t+"-"+{"\u043e\u0439":"\u0439","\u044b\u0439":"\u0439","\u0430\u044f":"\u044f","\u043e\u0435":"\u0435","\u044b\u0435":"\u0435","\u044b\u043c":"\u043c","\u043e\u043c":"\u043c","\u044b\u0445":"\u0445","\u043e\u0433\u043e":"\u0433\u043e","\u043e\u043c\u0443":"\u043c\u0443","\u044b\u043c\u0438":"\u043c\u0438"}[a]})}}),function(){var t=["typograf-oa-lbracket","typograf-oa-n-lbracket","typograf-oa-sp-lbracket"],a="ru/optalign/bracket";e.addRule({name:a,handler:function(e){return e.replace(/( |\u00A0)\(/g,'<span class="typograf-oa-sp-lbracket">$1</span><span class="typograf-oa-lbracket">(</span>').replace(/^\(/gm,'<span class="typograf-oa-n-lbracket">(</span>')},disabled:!0,htmlAttrs:!1}).addInnerRule({name:a,queue:"start",handler:function(a){return e._removeOptAlignTags(a,t)}}).addInnerRule({name:a,queue:"end",handler:function(a){return e._removeOptAlignTagsFromTitle(a,t)}})}(),function(){var t=["typograf-oa-comma","typograf-oa-comma-sp"],a="ru/optalign/comma";e.addRule({name:a,handler:function(e,t,a){var n=new RegExp("(["+a.getData("char")+"\\d\u0301]+), ","gi");return e.replace(n,'$1<span class="typograf-oa-comma">,</span><span class="typograf-oa-comma-sp"> </span>')},disabled:!0,htmlAttrs:!1}).addInnerRule({name:a,queue:"start",handler:function(a){return e._removeOptAlignTags(a,t)}}).addInnerRule({name:a,queue:"end",handler:function(a){return e._removeOptAlignTagsFromTitle(a,t)}})}(),e._removeOptAlignTags=function(e,t){var a=new RegExp('<span class="('+t.join("|")+')">([^]*?)</span>',"g");return e.replace(a,"$2")},e._removeOptAlignTagsFromTitle=function(t,a){return t.replace(/<title>[^]*?<\/title>/i,function(t){return e._removeOptAlignTags(t,a)})},function(){var t=["typograf-oa-lquote","typograf-oa-n-lquote","typograf-oa-sp-lquote"],a="ru/optalign/quote";e.addRule({name:a,handler:function(t){var a=this.getSetting("common/punctuation/quote","ru"),n="(["+a.left[0]+(a.left[1]||"")+"])",r=new RegExp("(^|\n\n|"+e._privateLabel+")("+n+")","g"),u=new RegExp("([^\n"+e._privateLabel+"])([ \xa0\n])("+n+")","gi");return t.replace(r,'$1<span class="typograf-oa-n-lquote">$2</span>').replace(u,'$1<span class="typograf-oa-sp-lquote">$2</span><span class="typograf-oa-lquote">$3</span>')},disabled:!0,htmlAttrs:!1}).addInnerRule({name:a,queue:"start",handler:function(a){return e._removeOptAlignTags(a,t)}}).addInnerRule({name:a,queue:"end",handler:function(a){return e._removeOptAlignTagsFromTitle(a,t)}})}(),e.addRule({name:"ru/other/accent",handler:function(e){return e.replace(/([\u0430-\u044f\u0451])([\u0410\u0415\u0401\u0418\u041e\u0423\u042b\u042d\u042e\u042f])([^\u0410-\u042f\u0401\w]|$)/g,function(e,t,a,n){return t+a.toLowerCase()+"\u0301"+n})},disabled:!0}),function(){function t(e){var t,r,c="",d=e[0];if(e.length<8)return n(e);if(e.length>10)if("+"===d){if(e[1]!==s)return e;t=!0,e=e.substr(2)}else"8"===d&&(r=!0,e=e.substr(1));for(var p=l;p>=o;p--){var h=+e.substr(0,p);if(i.indexOf(h)>-1){c=e.substr(0,p),e=e.substr(p);break}}return c||(c=e.substr(0,u),e=e.substr(u)),(t?"+"+s+"\xa0":"")+(r?"8\xa0":"")+a(c)+"\xa0"+n(e)}function a(e){var t=+e,a=e.length,n=[e],r=!1;if(a>3)switch(a){case 4:n=[e.substr(0,2),e.substr(2,2)];break;case 5:n=[e.substr(0,3),e.substr(3,3)];break;case 6:n=[e.substr(0,2),e.substr(2,2),e.substr(4,2)]}else r=t>900&&t<=999||495===t||499===t;return n=n.join("-"),r?n:"("+n+")"}function n(e){var t="";return e.length%2&&(t=e[0],t+=e.length<=5?"-":"",e=e.substr(1,e.length-1)),t+e.split(/(?=(?:\d\d)+$)/).join("-")}function r(e){return e.replace(/[^\d+]/g,"")}var u=5,s="7",i=[],l=8,o=2;[4162,416332,8512,851111,4722,4725,391379,8442,4732,4152,4154451,4154459,4154455,41544513,8142,8332,8612,8622,3525,812,8342,8152,3812,4862,3422,342633,8112,9142,8452,3432,3434,3435,4812,3919,8432,8439,3822,4872,3412,3511,3512,3022,4112,4852,4855,3852,3854,8182,818,90,3472,4741,4764,4832,4922,8172,8202,8722,4932,493,3952,3951,3953,411533,4842,3842,3843,8212,4942,3912,4712,4742,8362,495,499,4966,4964,4967,498,8312,8313,3832,383612,3532,8412,4232,423370,423630,8632,8642,8482,4242,8672,8652,4752,4822,482502,4826300,3452,8422,4212,3466,3462,8712,8352,"901-934","936-939","950-953",958,"960-969","977-989","991-997",999].forEach(function(e){if("string"==typeof e)for(var t=e.split("-"),a=+t[0];a<=+t[1];a++)i.push(a);else i.push(e)}),e.addRule({name:"ru/other/phone-number",live:!1,handler:function(a){var n=e._privateLabel,u=new RegExp("(^|,| |"+n+")(\\+7[\\d\\(\\) \xa0-]{10,18})(?=,|;|"+n+"|$)","gm");return a.replace(u,function(e,a,n){var u=r(n);return 12===u.length?a+t(u):e}).replace(/(^|[^\u0430-\u044f\u0451])(\u0442\.|\u0442\u0435\u043b\.|\u0444\.|\u043c\u043e\u0431\.|\u0444\u0430\u043a\u0441|\u0441\u043e\u0442\u043e\u0432\u044b\u0439|\u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0439|\u0442\u0435\u043b\u0435\u0444\u043e\u043d)(:?\s*?)([+\d(][\d \u00A0\-()]{3,}\d)/gi,function(e,a,n,u,s){var i=r(s);return i.length>=5?a+n+u+t(i):e})}})}(),e.addRule({name:"ru/space/afterHellip",handler:function(e){return e.replace(/([\u0430-\u044f\u0451])(\.\.\.|\u2026)([\u0410-\u042f\u0401])/g,"$1$2 $3").replace(/([?!]\.\.)([\u0430-\u044f\u0451a-z])/gi,"$1 $2")}}),e.addRule({name:"ru/space/year",handler:function(e,t,a){var n=new RegExp("(^| |\xa0)(\\d{3,4})(\u0433\u043e\u0434([\u0430\u0443\u0435]|\u043e\u043c)?)([^"+a.getData("char")+"]|$)","g");return e.replace(n,"$1$2 $3$5")}}),e.addRule({name:"ru/symbols/NN",handler:function(e){return e.replace(/\u2116\u2116/g,"\u2116")}}),e.addRule({name:"ru/punctuation/ano",handler:function(e){var t=new RegExp("([^!?,:;\\-\u2012\u2013\u2014])([ \xa0\\n])(\u0430|\u043d\u043e)(?= |\xa0|\\n)","g");return e.replace(t,"$1,$2$3")}}),e.addRule({name:"ru/punctuation/exclamation",live:!1,handler:function(e){return e.replace(/(^|[^!])!{2}($|[^!])/gm,"$1!$2").replace(/(^|[^!])!{4}($|[^!])/gm,"$1!!!$2")}}),e.addRule({name:"ru/punctuation/exclamationQuestion",index:"+5",handler:function(e){var t=new RegExp("(^|[^!])!\\?([^?]|$)","g");return e.replace(t,"$1?!$2")}}),e.addRule({name:"ru/punctuation/hellip",handler:function(e){return e.replace(/(^|[^.])\.{3,4}([^.]|$)/g,"$1\u2026$2").replace(/(^|[^.])(\.\.\.|\u2026),/g,"$1\u2026").replace(/(!|\?)(\.\.\.|\u2026)([^.]|$)/g,"$1..$3")}}),function(){var t={A:"\u0410",a:"\u0430",B:"\u0412",E:"\u0415",e:"\u0435",K:"\u041a",M:"\u041c",H:"\u041d",O:"\u041e",o:"\u043e",P:"\u0420",p:"\u0440",C:"\u0421",c:"\u0441",T:"\u0422",y:"\u0443",X:"\u0425",x:"\u0445"},a=Object.keys(t).join("");e.addRule({name:"ru/typo/switchingKeyboardLayout",handler:function(e){var n=new RegExp("(["+a+"]{1,3})(?=[\u0410-\u042f\u0401\u0430-\u044f\u0451]+?)","g");return e.replace(n,function(e,a){for(var n="",r=0;r<a.length;r++)n+=t[a[r]];return n})}})}(),e});